<template>
  <ele-modal
    form
    :width="820"
    :model-value="modelValue"
    :title="'学生:'+studentObject.name+'('+studentObject.code+')'+'推荐表信息展示'"
    @update:modelValue="updateModelValue">
    <ele-alert v-if="studentObject.studentRecommendSubmit == '1'" title="该生还未提交推荐表信息采集！" type="warning"
               :closable="false" show-icon style="margin-bottom: 20px;"/>
    <el-tabs v-model="activeName" v-else>
      <el-tab-pane label="基础信息" name="first">
        <el-descriptions border>
          <el-descriptions-item label="学生">{{ studentObject.name }}({{ studentObject.code }})</el-descriptions-item>
          <el-descriptions-item label="联系方式">{{ studentObject.phoneNumber }}</el-descriptions-item>
          <el-descriptions-item label="qq">{{ studentObject.qq }}</el-descriptions-item>
          <el-descriptions-item label="邮箱">{{ studentObject.email }}</el-descriptions-item>
          <el-descriptions-item label="政治面貌">{{ studentObject.politicalStatus }}</el-descriptions-item>
        </el-descriptions>
        <el-divider/>
        <el-descriptions border>
          <el-descriptions-item label="生源所在地">
            <el-tag type="warning">{{ studentObject.source }}</el-tag>
          </el-descriptions-item>
        </el-descriptions>
        <el-divider/>
        <el-descriptions :column="1" border>
          <el-descriptions-item label="技能证书">{{ studentObject.qualification }}</el-descriptions-item>
          <el-descriptions-item label="计算机等级">{{ studentObject.computerLevel }}</el-descriptions-item>
          <el-descriptions-item label="外语等级">{{ studentObject.foreignLanguageEvel }}</el-descriptions-item>
        </el-descriptions>
        <el-divider/>
        <el-descriptions border>
          <el-descriptions-item label="求职意向">{{ studentObject.jobIntention }}</el-descriptions-item>
        </el-descriptions>
      </el-tab-pane>
      <el-tab-pane label="家庭信息" name="second">
        <el-descriptions :column="2" border>
          <el-descriptions-item label="家庭地址">{{ studentObject.homeAddress }}</el-descriptions-item>
          <el-descriptions-item label="家庭邮编">{{ studentObject.homeCode }}</el-descriptions-item>
          <el-descriptions-item label="家庭联系电话">{{ studentObject.homePhone }}</el-descriptions-item>
          <el-descriptions-item label="城乡生源">
            <el-tag>{{ studentObject.isCityStudent == '1' ? "城镇" : "农村" }}</el-tag>
          </el-descriptions-item>
        </el-descriptions>
      </el-tab-pane>
      <el-tab-pane label="在校荣誉" name="third">
        <el-descriptions :column="1" border>
          <el-descriptions-item label="在校荣誉1">{{ studentObject.rewardPunishmentPrize1 }}</el-descriptions-item>
          <el-descriptions-item label="在校荣誉2">{{ studentObject.rewardPunishmentPrize2 }}</el-descriptions-item>
          <el-descriptions-item label="在校荣誉3">{{ studentObject.rewardPunishmentPrize3 }}</el-descriptions-item>
          <el-descriptions-item label="在校荣誉4">{{ studentObject.rewardPunishmentPrize4 }}</el-descriptions-item>
          <el-descriptions-item label="在校荣誉5">{{ studentObject.rewardPunishmentPrize5 }}</el-descriptions-item>
        </el-descriptions>
      </el-tab-pane>
      <el-tab-pane label="实践经历" name="fourth">
        <el-descriptions :column="1" border>
          <el-descriptions-item label="在校工作或实践经历1">{{ studentObject.workContent1 }}</el-descriptions-item>
          <el-descriptions-item label="在校工作或实践经历2">{{ studentObject.workContent2 }}</el-descriptions-item>
          <el-descriptions-item label="在校工作或实践经历3">{{ studentObject.workContent3 }}</el-descriptions-item>
          <el-descriptions-item label="在校工作或实践经历4">{{ studentObject.workContent4 }}</el-descriptions-item>
          <el-descriptions-item label="在校工作或实践经历5">{{ studentObject.workContent5 }}</el-descriptions-item>
        </el-descriptions>
      </el-tab-pane>
      <el-tab-pane label="其它信息" name="fifth">
        <el-descriptions :column="1" border>
          <el-descriptions-item label="户口是否转入学校">
            <el-tag>{{ studentObject.isHkInSchool == '1' ? "未转入" : "已转入" }}</el-tag>
          </el-descriptions-item>
          <el-descriptions-item label="入学前户口所在单位">{{ studentObject.rxqhkszdpcs }}</el-descriptions-item>
          <el-descriptions-item label="入学前档案所在单位">{{ studentObject.rxqdaszdw }}</el-descriptions-item>
        </el-descriptions>
      </el-tab-pane>
      <el-tab-pane label="所在系意见" name="sixth">
        <el-descriptions :column="1" border v-if="studentObject.departmentOpinion">
          <el-descriptions-item label="所在系意见">
            {{ studentObject.departmentOpinion }}
          </el-descriptions-item>
        </el-descriptions>
        <ele-alert show-icon type="error" title="暂未填写所在系意见" :center="true" :closable="false" effect="light"
                   v-if="!studentObject.departmentOpinion"/>
      </el-tab-pane>
    </el-tabs>
    <el-divider/>
    <div style="text-align: center;">
      <el-button @click="updateModelValue(false)">关闭</el-button>
    </div>
  </ele-modal>
</template>


<script setup>
import {ref, reactive, watch} from 'vue';
import {EleMessage} from 'ele-admin-plus/es';
import {useFormData} from "@/utils/use-form-data.js";
import {selectStudentRecommendInfo} from "@/api/manage/recommend/admin/index.js";

const emit = defineEmits(['done', 'update:modelValue']);

const props = defineProps({
  /** 弹窗是否打开 */
  modelValue: Boolean,
  /** 修改回显的数据 */
  data: String
});

/** 提交状态 */
const loading = ref(false);

/** 编辑器配置 */
const config = ref({
  height: 380
});

const form = ref({
  departmentOpinion: null
});

const studentObject = ref({
  name: '',
  code: ''
});

/** 更新modelValue */
const updateModelValue = (value) => {
  emit('update:modelValue', value);
};


const selectCheckInfo = () => {
  loading.value = true;
  selectStudentRecommendInfo(props.data).then(response => {
    studentObject.value.name = response.data.name;
    studentObject.value.code = response.data.code;

    studentObject.value.phoneNumber = response.data.phoneNumber;
    studentObject.value.politicalStatus = response.data.politicalStatus;
    studentObject.value.qq = response.data.qq;
    studentObject.value.qualification = response.data.qualification;

    studentObject.value.computerLevel = response.data.computerLevel;
    studentObject.value.email = response.data.email;
    studentObject.value.foreignLanguageEvel = response.data.foreignLanguageEvel;
    studentObject.value.homeAddress = response.data.homeAddress;
    studentObject.value.homeCode = response.data.homeCode;
    studentObject.value.homePhone = response.data.homePhone;
    studentObject.value.isCityStudent = response.data.isCityStudent;
    studentObject.value.isHkInSchool = response.data.isHkInSchool;
    studentObject.value.jobIntention = response.data.jobIntention;

    //生源所在地
    studentObject.value.source = response.data.source;

    studentObject.value.rewardPunishmentPrize1 = response.data.rewardPunishmentPrize1;
    studentObject.value.rewardPunishmentPrize2 = response.data.rewardPunishmentPrize2;
    studentObject.value.rewardPunishmentPrize3 = response.data.rewardPunishmentPrize3;
    studentObject.value.rewardPunishmentPrize4 = response.data.rewardPunishmentPrize4;
    studentObject.value.rewardPunishmentPrize5 = response.data.rewardPunishmentPrize5;

    studentObject.value.rxqdaszdw = response.data.rxqdaszdw;
    studentObject.value.rxqhkszdpcs = response.data.rxqhkszdpcs;

    studentObject.value.workContent1 = response.data.workContent1;
    studentObject.value.workContent2 = response.data.workContent2;
    studentObject.value.workContent3 = response.data.workContent3;
    studentObject.value.workContent4 = response.data.workContent4;
    studentObject.value.workContent5 = response.data.workContent5;

    studentObject.value.departmentOpinion = response.data.departmentOpinion;
    studentObject.value.studentRecommendSubmit = response.data.studentRecommendSubmit;

    loading.value = false;
  })
}


const activeName = ref('first');


selectCheckInfo();

</script>

